<template>
  <div>
    <div class="header">
      <div class="info">
        <div class="proTitle">
          <img src="../../assets/logo.png" alt="" />
          <h1>大宗建材服务平台</h1>
          <span>招标广场</span>
        </div>
        <div>
          <el-input class="border_color" style="width: 550px" size="small" v-model.trim="searchValue">
            <el-button slot="append">搜索</el-button>
          </el-input>
        </div>
      </div>
    </div>
    <div class="nav">
      <div class="nav_box">
        <span :class="navIndex == '1' ? 'on' : ''" style="margin-left: 0" @click="navClick('1', '/')">招标广场</span>
        <span :class="navIndex == '2' ? 'on' : ''" @click="navClick('2', '/index/supplier')">供应商</span>
      </div>
    </div>
    <div class="con">
      <!-- <bidd-square></bidd-square> -->
      <router-view></router-view>
    </div>
  </div>
</template>
<script>
// import biddSquare from "../../components/BiddSquare";
export default {
  data() {
    return {
      searchValue: '',
      navIndex: '1'
    }
  },
  components: {
    // biddSquare,
  },
  methods: {
    navClick(index, path) {
      this.navIndex = index
      this.$router.push(path)
    }
  },
  mounted() {
    const path = this.$route.path
    this.navIndex = '1'
    if (/\/index\/supplier/.test(path)) {
      this.navIndex = '2'
    }
    if (this.$store.state.whetherLogin) {
      this.$store.dispatch('getMenuList')
    }
  },
  beforeRouteUpdate(to, from, next) {
    if (/\/index\/supplier/.test(to.path)) {
      this.navIndex = '2'
    } else {
      this.navIndex = '1'
    }
    next()
  }
}
</script>
<style scoped lang="less">
.header {
  width: 100%;
  height: 130px;
  color: #fff;
  background-color: #fff;
  display: flex;
  justify-content: center;
  .info {
    width: 1200px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    h1 {
      font-size: 36px;
      color: #fa7355;
      font-weight: 500;
      display: flex;
      height: 47px;
      align-items: center;
      margin-left: 30px;
      padding-right: 20px;
      border-right: 1px solid #fa7355;
    }
    .proTitle {
      display: flex;
      align-items: center;
      span {
        display: flex;
        align-items: center;
        color: #fa7355;
        margin-left: 20px;
        font-size: 26px;
      }
    }
  }
}
.nav {
  width: 100%;
  height: 60px;
  display: flex;
  justify-content: center;
  background-color: #f8f8f8;
  .nav_box {
    width: 1200px;
    display: flex;
    justify-content: left;
    // align-items: center;
    span {
      font-size: 20px;
      margin-left: 50px;
      cursor: pointer;
      margin-top: 16px;
      padding-bottom: 10px;
    }
    .on {
      color: #fa7355;
      border-bottom: 4px solid #fa7355;
    }
  }
}
.con {
  background-color: #fff;
  width: 100%;
  display: flex;
  justify-content: center;
}
</style>
